package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * @author wmz
 * @date 2024/1/27 13:59
 * @description UserMapper
 */
@Mapper
public interface UserMapper {
    /**
     * 根据openid查询用户
     * @param openId
     * @return
     */
    @Select("select * from user where openid = openId")
    User selectUserByOpenId(String openId);

    /**
     * 新增用户
     * @param user
     */
    void insert(User user);

    /**
     * 通过id获取用户
     * @param userId
     * @return
     */
    @Select("select * from user where id=#{userId}")
    User getById(Long userId);

    /**
     * 根据动态条件来统计用户数量
     * @param map
     * @return
     */
    Integer countByMap(Map map);


}
